<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../引入vue2.js"></script>
</head>

<body>
    <div id="app">
        <input type="text" v-model="mytext">
        <ul>
            <li v-for="item in computed1" :key:="item">
                {{item}}
            </li>
        </ul>
        <!-- 支持函数表达式 -->
        {{computed1}}
    </div>
</body>
<script>
    let vm = new Vue({
        el: '#app',
        data: {
            mytext: '',
            list: ["aaa", "add", "bbb", "bbc", "ccc", "ddd", "eee", "ade"],
        },
        methods: {

        },
        // 计算属性依赖状态的变化
        computed: {
            computed1() {
                console.log('----------test-------');
                return this.list.filter(item => item.includes(this.mytext))
            }
        }
    })
</script>

</html>